/**
 * Created by seeker910 on 2014/8/23.
 * @description 组件名称命名约定：继承container组件，名称以ViewPart结尾;继承control组件，名称以Part结尾
 * 列表组件（header + list ）
 */
Rsd.define('Rsd.hermit.sections.ScrollListPart', {
    extend: 'Rsd.control.List',
    requires: [],
    xtype:'scroll-list',
    domEditable:true,
     /**
     * @description true:表示只允许在模板中修改
     */
    editInMaster:false,
    autoScroll:false,
    itemXtype:'label',
    //itemStyle:{height:'60px',lineHeight:'60px'} ,
    label:{ 
        cls:'x-t-header',
        position:'top',
        align:'center',
        height:40,
        space:1
    },
    dataSource:null,
    border:false,
    /*
    * */
    constructor: function ScrollListPart(config) {

        config = config || {};
        this.apply(config);
    },
    /**
     * 
     */
    onAfterRender:function onAfterRender() {

        this.callParent();

        if(this.autoScroll){
            this.scroll();
        }
    }, 
   
    /** 
     * */ 
    stop:function stop(){
        clearInterval(this.sn);
    },
    /** 
     * */ 
    scroll:function scroll(){
        var  me = this;
        if(me.sn)
        {
            clearInterval(me.sn);
        }
        var _fn = function()
         {
             me.scrollItem.call(me);
         }
         setTimeout(function(){
            me.sn = setInterval(_fn,2000);
         },200);
       
    },
     /**
     * 
     */
    scrollItem:function scrollItem(){

        return;
        //暂未实现
        var _list = Rsd.select('#'+ this.id + ' li');

        if(_list.length > 0)
        {
            for(var i in _list)
            {
                var item = _list[i];
                item.style.position = "absolute";
                var _t = Number(item.style.top)||0;
                var _h = Number(item.clientHeight)||0;
              
                var top =  _h * i + _t;
                item.style.top = top+'px';

                //console.log(i,'滚动效果未实现',top);
            }
        }

    }

});
